<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <!-- Tell the browser to be responsive to screen width -->
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="">
  <meta name="author" content="">
  <!-- Favicon icon -->
  <!--<link rel="stylesheet" href="css/iview.min.css">-->
  <!--<link rel="stylesheet" type="text/css" href="http://unpkg.com/iview/dist/styles/iview.css">-->
  <link rel="icon" type="image/png" sizes="16x16" href="../assets/images/favicon.ico">
  <title>壹脉智能CRM</title>
  <!-- Bootstrap Core CSS -->
  <link href="./css/bootstrap.min.css" rel="stylesheet">
  <link href="./css/perfect-scrollbar.min.css" rel="stylesheet">
  <!-- This page CSS -->
  <!-- chartist CSS -->
  <!-- <link href="../assets/node_modules/morrisjs/morris.css" rel="stylesheet"> -->
  <!--c3 CSS -->
  <!-- <link href="../assets/node_modules/c3-master/c3.min.css" rel="stylesheet"> -->
  <!--Toaster Popup message CSS -->
  <!-- <link href="../assets/node_modules/toast-master/css/jquery.toast.css" rel="stylesheet"> -->
  <!-- Custom CSS -->
  <link href="css/style.min.css" rel="stylesheet">
  <link rel="stylesheet" href="css/daterangepicker.css">
  <!-- Dashboard 1 Page CSS -->
  <!--<link href="css/pages/dashboard1.css" rel="stylesheet">-->
  <!-- You can change the theme colors from here -->
  <link href="css/colors/default.css" id="theme" rel="stylesheet">
  <link rel="stylesheet" href="css/diy.css">
  <!-- page css -->
  <link href="css/pages/user-card.css" rel="stylesheet">
  <!-- Popup CSS -->
  <link href="css/magnific-popup.css" rel="stylesheet">
  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>

<body class="fix-header fix-sidebar card-no-border">
  <div class="preloader">
    <div class="loader">
      <div class="loader__figure"></div>
      <p class="loader__label">壹脉</p>
    </div>
  </div>
  <div id="main-wrapper">
    <header class="topbar">
      <nav class="navbar top-navbar navbar-expand-md navbar-light">
        <div class="navbar-header">
          <a class="navbar-brand" href="../index.html">
            <b>
              <img src="../assets/images/diy/yimai.png" alt="homepage" class="dark-logo" />
              <!--<img src="../assets/images/logo-light-icon.png" alt="homepage" class="light-logo"/>-->
            </b>
            <span>
              <span class="fs18 cblue p-l-6 fbold">壹脉智能CRM</span>
            </span>
          </a>
        </div>
        <div class="navbar-collapse">
          <ul class="navbar-nav mr-auto">
            <li class="nav-item"><a class="nav-link nav-toggler hidden-md-up waves-effect waves-dark" href="javascript:void(0)"><i class="sl-icon-menu"></i></a></li>
            <li class="nav-item"><a class="nav-link sidebartoggler hidden-sm-down waves-effect waves-dark" href="javascript:void(0)"><i class="sl-icon-menu"></i></a></li>
          </ul>
          <user-head></user-head>
        </div>
      </nav>
    </header>
    <aside class="left-sidebar">
      <div class="scroll-sidebar">
        <company-position></company-position>
        <nav class="sidebar-nav p-0">
          <c-slider current="5"></c-slider>
        </nav>
      </div>
    </aside>
    <div class="page-wrapper">
      <div class="container-fluid">
        <div class="row page-titles">
          <div class="col-md-5 align-self-center">
            <h3 class="text-themecolor">秒杀设置</h3>
            <ol class="breadcrumb">
              <li class="breadcrumb-item"><a href="javascript:void(0)">HOME</a></li>
              <li class="breadcrumb-item">营销活动</li>
              <li class="breadcrumb-item">秒杀</li>
              <li class="breadcrumb-item">
                <a href="/main/spikeGoodsList.html">秒杀商品列表</a>
              </li>
              <li class="breadcrumb-item active">秒杀详情</li>
            </ol>
          </div>
        </div>
        <div class="bgfff p-l-29 p-r-31 p-t-29 p-b-50">
          <div class="row assemble-form">
            <div class="col-xl-12 form-item">
              <span>活动类型：</span>
              <span>{{detail && detail.killType === 1 ? '限时秒杀' : '促销秒杀'}}</span>
            </div>
            <div class="col-xl-12 form-item">
              <span>活动时长：</span>
              <div>
                <div>起 ：{{detail.startTime | formatDate('MM/dd hh:mm')}}</div>
                <div>止 ：{{detail.endTime | formatDate('MM/dd hh:mm')}}</div>
              </div>
            </div>
            <div class="col-xl-12 form-item">
              <span>单账号最多可购买数：</span>
              <span>{{detail.maxPurchase}}</span>
            </div>
          </div>
          <div class="disflex align-cen">
            <span>秒杀商品</span>
          </div>
          <table class="align-cen-table m-t-20 textc display nowrap table table-hover table-bordered bgf6f9fa m-b-20">
            <thead>
              <tr>
                <th>产品ID</th>
                <th class="w20p">产品</th>
                <th>分类</th>
                <th>价格</th>
                <th>库存</th>
                <th>总销量</th>
                <th>发布时间</th>
              </tr>
            </thead>
            <tbody class="bgfff" v-if="detail">
              <tr class="curpointer">
                <td v-html="detail.goodsId"></td>
                <td v-html="detail.goodsName" class="w20p"></td>
                <td v-html="detail.goodsTypeName"></td>
                <td>{{((detail.minPrice/100) || 0 ).toFixed(2)}}</td>
                <td v-html="detail.goodsNum"></td>
                <td v-html="detail.totalBuyNum"></td>
                <td>{{detail.createTime | formatDate('yyyy/MM/dd hh:mm')}}</td>
              </tr>
            </tbody>
          </table>
          <div class="">
            <span>商品规格</span>
          </div>
          <table class="align-cen-table m-t-20 textc display nowrap table table-hover table-bordered bgf6f9fa m-b-20">
            <thead>
              <tr>
                <th>商品名称</th>
                <th>商品类型</th>
                <th>商品规格</th>
                <th>商品库存</th>
                <th>商品价格</th>
                <th>秒杀金额</th>
                <th>活动库存</th>
              </tr>
            </thead>
            <tbody class="bgfff">
              <tr class="curpointer" v-for="spec in detailArray">
                <td>{{spec.specName}}</td>
                <td>{{spec.typeName}}</td>
                <td>{{spec.specAttribute}}</td>
                <td>{{spec.specNum}}</td>
                <td>{{spec.price | formatMoney}}</td>
                <td>{{spec.killPrice | formatMoney}}</td>
                <td>{{spec.killNum}}</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
  </div>
  <!-- All Jquery -->
  <!-- ============================================================== -->
  <script src="js/jquery.min.js"></script>
  <!-- Bootstrap popper Core JavaScript -->
  <!-- <script src="../assets/node_modules/bootstrap/js/popper.min.js"></script> -->
  <script src="js/bootstrap.min.js"></script>
  <script src="js/perfect-scrollbar.jquery.min.js"></script>
  <script src="js/sidebarmenu.js"></script>
  <script src="js/custom.min.js"></script>
  <!-- ============================================================== -->
  <!-- This page plugins -->
  <!-- ============================================================== -->
  <script src="js/vue.js"></script>
  <script src="js/layer/layer.js"></script>
  <!--<script type="text/javascript" src="http://vuejs.org/js/vue.min.js"></script>-->
  <!--<script src="js/headers.js"></script>-->
  <!--<script src="js/Aside.js"></script>-->
  <script src="js/moment.js"></script>
  <script src="js/daterangepicker.js"></script>
  <script src="js/config.js"></script><script src="js/extend.js"></script>
  <script>
  $(function() {
    var vw = new Vue({
      el: '#main-wrapper',
      data: {
        detail: {},
        detailArray: []
      },
      mounted() {
        const killId = $.formatParams(location.href).id
        $.cAjax('/crmPc/secKill/updateKillGoodsInfo', {
          data: {
            killId: killId
          }
        }).then(res => {
          this.detail = res
          let temp = []
          res.goodSpecModelList.forEach((item, index) => {
            item.goodSpecModelList.forEach(items => {
              temp.push({
                specName: res.goodsName,
                typeName: item.specName,
                ...items
              })
            })
          })
          this.detailArray = temp
        })
      },
      methods: {
        save(type) {
          console.log(this.specList);
          $.cAjax('/crmPc/secKill/addKillGoodsInfo', {
            data: {
              goodSpecRequestList: this.specList,
              draftType: type,
              goodsId: this.goodsInfo.goodsId,
              startTime: this.startTime,
              endTime: this.endTime,
              killType: this.killType,
              maxPurchase: this.maxPurchase,
              updateType: 0
            }
          }).then(res => {
            layer.msg(type == 1 ? '发布成功' : '保存成功');
            setTimeout(function() {
              history.back();
            }, 1.5 * 1000)
          })
        }
      }
    })
  })
  </script>
</body>

</html>
